<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数作为方法调用-2</title>
</head>

<body>
    <p>在一个对象方法中 ，<b>this</b> 的值是对象本身。</p>
    <p id="demo"></p>
    <script>
        var myObject = {
            firstName: "John",
            lastName: "Doe",
            fullName: function () {
                return this;
            }
        }
        document.getElementById("demo").innerHTML = myObject.fullName();
    </script>
</body>

</html>